package number5;

import java.io.File;

public class Demo {
public static void main(String[] args) throws Exception {
	
	File srcFile =  new File("copy.mp3");
	File destFile =  new File("1.mp3");
	
	copy copy = new copy(srcFile, destFile);
	copy.start();
	
	 while (copy.isAlive()) {
         try {
             Thread.sleep(10); // 每100毫秒检查一次
             long copiedBytes = destFile.length();
             long totalBytes = srcFile.length();
             double progress = (double) copiedBytes / totalBytes * 100;
             System.out.println("复制进度：" + String.format("%.2f", progress) + "%");
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
     }

     System.out.println("复制完成！");
	
}
}
